from django.urls import path, include
from rest_framework.routers import DefaultRouter
from .views import CrawlerConfigViewSet, CrawlerCookiesAccountViewSet, TaskListView, PlatformDataView, ProxyConfigViewSet
# 创建路由器实例
router = DefaultRouter()

# 注册 CrawlerConfigViewSet
router.register(r'crawler-configs', CrawlerConfigViewSet, basename='crawlerconfig')

# 注册 ProxyConfigViewSet
router.register(r'proxy-configs', ProxyConfigViewSet, basename='proxyconfig')

urlpatterns = [
    # 包含路由器生成的 URL
    # path('', include(router.urls)),
    path('task-list/', TaskListView.as_view(), name='task-list'),
    path('platform-data/<str:task_id>/', PlatformDataView.as_view(), name='platform-data'),
]
# 注册 CrawlerCookiesAccountViewSet
router.register(r'crawler-cookies-accounts', CrawlerCookiesAccountViewSet, basename='crawlercookiesaccount')
urlpatterns += router.urls